'use strict'

/**
 * 常量路径
 * @type {Object}
 */
const path = require('path')


/**
 * @type{{
 *
 * dev: {assetsSubDirectory: string, assetsPublicPath: string, proxyTable: {}, host: string, port: number, autoOpenBrowser: boolean, errorOverlay: boolean, notifyOnErrors: boolean, poll: boolean, useEslint: boolean, showEslintErrorsInOverlay: boolean, devtool: string, cacheBusting: boolean, cssSourceMap: boolean},
 *
 * build: {index: *, assetsRoot: *, assetsSubDirectory: string, assetsPublicPath: string, productionSourceMap: boolean, devtool: string, productionGzip: boolean, productionGzipExtensions: string[], bundleAnalyzerReport: *}
 * }}
 */
module.exports = {


  dev: {

    /**
     * static 资源路径
     */
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},

    /**
     * 服务器设置
     */
    host: 'localhost',

    /**
     * 端口
     */
    port: 8080,

    /**
     * 自动打开浏览器
     */
    autoOpenBrowser: true,
    errorOverlay: false,
    notifyOnErrors: false,
    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

    // Use Eslint Loader?
    // If true, your code will be linted during bundling and
    // linting errors and warnings will be shown in the console.
    useEslint: false,
    // If true, eslint errors and warnings will also be shown in the error overlay
    // in the browser.
    showEslintErrorsInOverlay: false,

    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/#development
    devtool: 'cheap-module-eval-source-map',

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html#cachebusting
    cacheBusting: true,

    cssSourceMap: true
  },

  build: {

    /**
     * bulid的时候的项目的build路径
     */
    index: path.resolve(__dirname, '../dist/index.html'),

    /**
     * 输出路径
     */
    assetsRoot: path.resolve(__dirname, '../dist'),

    /**
     * assets的存放路径
     * 公共路径
     */
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',


    /**
     * 产品的资源map
     */
    productionSourceMap: true,

    /**
     * 开发工具 资源map
     */
    devtool: '#source-map',

    /**
     * zip压缩
     */
    productionGzip: false,

    /**
     * 产品的Gzip的扩展名
     */
    productionGzipExtensions: ['js', 'css'],

    // Run the build command with an extra argument to
    // View the bundle analyzer report after build finishes:
    // `npm run build --report`
    // Set to `true` or `false` to always turn it on or off
    bundleAnalyzerReport: process.env.npm_config_report
  }
}
